def search_triplets(arr):
  triplets = []
  temp_list = []
  left = 0
  right = len(arr)-1


  while left < right:
    temp_right = right
    while left < temp_right:
      subarr = arr[left+1:temp_right]
      temp_list = [arr[left],arr[temp_right],0-arr[left]-arr[temp_right]]
      temp_list.sort()
      if (0-arr[left]-arr[temp_right]) in subarr:
        if temp_list not in triplets:
          triplets.append(temp_list)  
      temp_right -= 1
    left += 1
    

  # TODO: Write your code here
  return triplets

def main():
  print(search_triplets([-3, 0, 1, 2, -1, 1, -2]))
  print(search_triplets([-5, 2, -1, -2, 3]))


main()